package com.wave.wavesystem.serve.exception;

import com.wave.common.exception.ReLoginException;
import com.wave.common.exception.WaveException;
import com.wave.common.model.Result;
import io.swagger.v3.oas.annotations.Hidden;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import static cn.dev33.satoken.SaManager.log;

@RestControllerAdvice
@Hidden
public class GlobalExceptionHandler {

    @ExceptionHandler(WaveException.class)
    public Result<?> handleWaveException(WaveException e) {
        log.error("系统异常: ", e);
        return Result.fail(e);
    }

    @ExceptionHandler(ReLoginException.class)
    public Result<?> handleReLoginException(ReLoginException e) {
        log.error("系统异常: ", e);
        return Result.fail(e);
    }
}
